﻿<Window
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
	xmlns:local="clr-namespace:EmbDocumentInhalatorSetup.ToolClasses"
	
	xmlns:me="clr-namespace:EmbDocumentInhalatorSetup"
	xmlns:sys="clr-namespace:System;assembly=mscorlib"
	xmlns:interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
	x:Class="EmbDocumentInhalatorSetup.MainWindow"
	x:Name="Window"
	Title="MainWindow"
	Width="588" Height="486" ResizeMode="NoResize">
	<Window.Background>
		<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
			<GradientStop Color="Black" Offset="0.157"/>
			<GradientStop Color="White" Offset="1"/>
		</LinearGradientBrush>
	</Window.Background>

	<Window.Resources>

		<local:ItemTemplateSelector x:Key="dataTemplateSelector"/>

		<DataTemplate x:Key="cellTemplateIsInstalled">
			<StackPanel>
			  
				<ComboBox x:Name="cmbInstalledOnServer" Width="150" IsSynchronizedWithCurrentItem="True" SelectionChanged="cmbNotInstalledOnServer_SelectionChanged" Loaded="cmbNotInstalledOnServer_Loaded">
					<ComboBox.Items>
							<ComboBoxItem Content="Remove"/>
						<ComboBoxItem Content="Ignore" IsSelected="True"/>
					</ComboBox.Items>
				</ComboBox>
			</StackPanel>
		</DataTemplate>

		<DataTemplate x:Key="cellTemplateIsNotInstalled">
			<StackPanel>
				<ComboBox x:Name="cmbNotInstalledOnServer" IsSynchronizedWithCurrentItem="True" Width="150" SelectionChanged="cmbNotInstalledOnServer_SelectionChanged" Loaded="cmbNotInstalledOnServer_Loaded">
					<ComboBox.Items>
						<ComboBoxItem Content="Install" IsSelected="True"/>
						<ComboBoxItem Content="Ignore"/>
					</ComboBox.Items>
				</ComboBox>
			</StackPanel>
		</DataTemplate>
		
		<HierarchicalDataTemplate x:Key="Feat" DataType="local:Feature"
								  ItemsSource="{Binding Path=SolutionFeatures}">
			<StackPanel Name="StackFeature">
				<TextBlock Text="Solution ID:" FontStyle="Italic"/>
				<TextBlock Text="{Binding SolutionID}" FontWeight="Bold"/>
				<TextBlock Text="Installed on Server?:"/>
				<TextBlock Text="{Binding IsInstalledOnServer}" x:Name="txtInstalled" 
				 >
				   
				</TextBlock>
			   
			</StackPanel>
		  
			<HierarchicalDataTemplate.ItemTemplate>
				<DataTemplate>
					 <StackPanel Orientation="Vertical" Background="Azure">
						<StackPanel Background="LightGray">
						<WrapPanel>
							<TextBlock Text="Feature Title:" FontStyle="Italic"/>
							<TextBlock Text="{Binding FeatureTitle}" FontWeight="Bold"/>
							</WrapPanel>
						</StackPanel>
						<StackPanel Background="Aqua">
							<WrapPanel>
								<TextBlock Text="Feature Scope" FontStyle="Italic">
								</TextBlock>
								<TextBlock FontWeight="Bold" x:Name="txtIsInstalled">
										 <TextBlock.Style>

									<Style TargetType="{x:Type TextBlock}">

									   <Style.Triggers>

											<DataTrigger Binding="{Binding Scope}" Value="Farm">

												<Setter Property="TextBlock.Text" Value="Farm Deployment" />

											</DataTrigger>
											<DataTrigger Binding="{Binding Scope}" Value="Site">

												<Setter Property="TextBlock.Text" Value="Site Deployment" />

											</DataTrigger>
									   </Style.Triggers>

									</Style>

							</TextBlock.Style>

								</TextBlock>
							</WrapPanel>
						</StackPanel>
					</StackPanel>
				</DataTemplate>
			</HierarchicalDataTemplate.ItemTemplate>
		   </HierarchicalDataTemplate>
		


	</Window.Resources>

		<Grid x:Name="LayoutRoot">
		<Grid.ColumnDefinitions>
			<ColumnDefinition/>
		</Grid.ColumnDefinitions>
		<Grid x:Name="Title" Height="89" Margin="40,17,17,0" VerticalAlignment="Top">
			<Label x:Name="lblTitle" Content="emb Sharepoint 2010 Solution Installer" Margin="0,35,86,3" FontSize="22" FontWeight="Bold" Foreground="#FFFEFBFB"/>
			<Image HorizontalAlignment="Right" Margin="0,0,9,41" Source="images/imagesCA8E56HK.jpg" Stretch="Fill" Width="77"/>
		</Grid>
		<ComboBox x:Name="cmbSites" Height="25" Margin="49,133,50,0" VerticalAlignment="Top"/>
		<Label x:Name="lblSitesCaption" Content="Site to install to" HorizontalAlignment="Left" Height="27" VerticalAlignment="Top" Width="127" ContentStringFormat="v" Foreground="#FFFEFBFB" FontWeight="Bold" FontSize="14.667" Margin="49,106,0,0"/>
		<Canvas x:Name="Progress" Height="85" Margin="49,0,101,51" VerticalAlignment="Bottom">
			<ProgressBar Height="22" Canvas.Top="35" Width="484" Name="prgInstallProgress" />
			<Label x:Name="lblInstallStatus" Content="Progress &amp; Status" ContentStringFormat="" Foreground="#FFFEFBFB" FontWeight="Bold" FontSize="14.667" Width="196.148" Height="31" Canvas.Top="3" />
			<Label x:Name="lblStatusText" Content="Installation not started." ContentStringFormat="" Foreground="#FFFEFBFB" FontWeight="Bold" FontSize="14.667" Height="33" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Canvas.Top="52" Width="484">
				<Label.Effect>
					<DropShadowEffect/>
				</Label.Effect>
			</Label>
		</Canvas>
		<Path x:Name="Devider" Data="M31,369 L573,369" Fill="#FFF4F4F5" Height="1" Margin="31,0,50,42" Stretch="Fill" Stroke="Black" VerticalAlignment="Bottom" StrokeThickness="2"/>
		<Button x:Name="btnStartInstall" Content="_Pre-Check" Margin="0,0,50,13.04" VerticalAlignment="Bottom" FontSize="13.333" FontWeight="Bold" HorizontalAlignment="Right" Width="133.696" Click="btnStartInstall_Click" />
		<TextBlock Height="22" Margin="40,0,236,8" TextWrapping="Wrap"  VerticalAlignment="Bottom"><Hyperlink NavigateUri="http://embeducation.myhost21.com/" RequestNavigate="Hyperlink_RequestNavigate"><Run Text="(c) 2011 - embeducation - Ilija Injac"/></Hyperlink></TextBlock>
		<Canvas x:Name="InstallActions" Margin="49,156,50,136">
			<Label x:Name="lblInstallActions" Content="Solutions Found" Width="127" ContentStringFormat="" Foreground="#FFFEFBFB" FontWeight="Bold" FontSize="14.667" Height="33"/>
			<TreeView Height="135" Canvas.Top="31" Width="483"  Name="lstFeatures" 
					  ItemsSource="{Binding}" ItemTemplate="{StaticResource Feat}" >
				<TreeView.Resources>
					<Style TargetType="TreeViewItem">
						<Style.Triggers>
							<DataTrigger Binding="{Binding Path=IsSharpoint14Solution}" Value="false">
								<Setter Property="Visibility"  Value="Collapsed"/>
							</DataTrigger>
						</Style.Triggers>
					</Style>
				</TreeView.Resources>

				<TreeView.Background>
					<LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
						<GradientStop Color="#FF89A3DE" Offset="1" />
						<GradientStop Color="#FFBECBE8" Offset="0" />
					</LinearGradientBrush>
				</TreeView.Background>
			</TreeView>
		</Canvas>
		<Canvas x:Name="InstallActionsChooseAction" Margin="49,156,50,136" d:IsHidden="True" Visibility="Collapsed">
			<Label x:Name="lblInstallActions1" Content="Install Action(s)" Width="127" ContentStringFormat="" Foreground="#FFFEFBFB" FontWeight="Bold" FontSize="14.667" Height="33"/>
			<ListView x:Name="lstInstallActions" Height="134" Canvas.Left="5" Canvas.Top="24" Width="467" ItemsSource="{Binding}" IsSynchronizedWithCurrentItem="True"> 
				<ListView.View>
					<GridView x:Name="grdvSolutions">
					   
						<GridViewColumn Header="Solution">
						   
							<GridViewColumn.CellTemplate>
								<DataTemplate>
									<StackPanel Orientation="Vertical">
										
										<StackPanel.ToolTip>
											
											<ListBox x:Name="lstFeatureTitles"  ItemsSource="{Binding Path=SolutionFeatures}">
												<ListBox.ItemTemplate>
													<DataTemplate>
														<StackPanel>
															<TextBlock Text="Feature:" FontWeight="Bold"/>
															<TextBlock Text="{Binding Path=FeatureTitle}"/>
														</StackPanel>
													</DataTemplate>
												</ListBox.ItemTemplate>
											</ListBox>
										</StackPanel.ToolTip>
										<TextBlock Text="{Binding Path=SolutionID}"/>
									</StackPanel>
								</DataTemplate>
							  
							</GridViewColumn.CellTemplate>
						  
						</GridViewColumn>
						<GridViewColumn x:Name="comboBoxColumn"
							Header="Please Choose Install Action"
							CellTemplateSelector="{StaticResource dataTemplateSelector}"/>
					</GridView>
				</ListView.View>
			</ListView>
		</Canvas>
	</Grid>
</Window>